<?php
/*
 * Created on Feb 10, 2011
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
set_time_limit(0);

define("ENTER",chr(13).chr(10));	//--- enter

include_once("../../configure/configure.php");						//--> global var
include_once("utils/XmlUtils.php");							//--> Xml

include_once("../../lib/impl/ContentImpl.php");

$xmlUtils	= new XmlUtils();							//--> Xml

$oContImpl 	= new ContentImpl(DB_TAG_MM);



$oConts 	= $oContImpl->getAll();

$xmlUtils->add('url', '', '', 'start');
		
$url = ENTER . 'http://www.hohomm.com';
$xmlUtils->add('loc', '', $url, 'start');
$xmlUtils->add('loc', '', '', 'end');

$xmlUtils->add('url', '', '', 'end');
		
foreach($oConts as $oCont){
	$contId = $oCont->id;
	$contN 	= $oCont->name;
	
	$oImgs = $oContImpl->getImages($contId, '');
	
	foreach($oImgs as $oImg){
		$imgId 		= $oImg->id;
		$imgName	= $oImg->name;
				
		$xmlUtils->add('url', '', '', 'start');
		
		// http://www.hohomm.com/details/115/1913/TOP29%20冬月枫
		$url = ENTER . "http://www.hohomm.com/details/$contId/$imgId/$imgName";
		
		$xmlUtils->add('loc', '', $url, 'start');
		$xmlUtils->add('loc', '', '', 'end');
		
		$xmlUtils->add('url', '', '', 'end');
	}
	
}

$xmlUtils->createXml('../../siteMapFiles/googleSiteMap.xml', 'urlset', ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"');
//$xmlUtils->createXml('../../siteMapFiles/googleSiteMap.xml', 'urlset', ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"');

echo "Created site map file successfully by Crontab \n"


?>
